//------------------------------------------------------------------------------
// <copyright file="HeroesCollection.cs" company="Damian Antonowicz">
//       copyright © 2010 Damian Antonowicz
// </copyright>
// <author>Damian Antonowicz</author>
// <email>poczta@damianantonowicz.pl</email>
//------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace DotBeer.Business.Entities
{
    public class HeroesCollection
    {
        #region private members

        ObservableCollection<HeroTavern> _heroes = new ObservableCollection<HeroTavern>();

        #endregion

        #region constructors

        public HeroesCollection()
        {
        }

        #endregion

        #region properties

        public ObservableCollection<HeroTavern> Heroes
        {
            get { return _heroes; }
        }

        public IEnumerable<HeroTavern> SentinelHeroes
        {
            get { return GetSentinelHeroes(); }
        }

        public IEnumerable<HeroTavern> ScourgeHeroes
        {
            get { return GetScourgeHeroes(); }
        }

        public IEnumerable<HeroTavern> NeutralHeroes
        {
            get { return GetNeutralHeroes(); }
        }

        #endregion

        #region public methods

        public IEnumerable<HeroTavern> GetHeroesBySide(Side side)
        {
            return _heroes.Where(h => h.Side == side);
        }

        #endregion

        #region private methods

        private IEnumerable<HeroTavern> GetSentinelHeroes()
        {
            return this.GetHeroesBySide(Side.Sentinel);
        }

        private IEnumerable<HeroTavern> GetScourgeHeroes()
        {
            return this.GetHeroesBySide(Side.Scourge);
        }

        private IEnumerable<HeroTavern> GetNeutralHeroes()
        {
            return this.GetHeroesBySide(Side.Neutral);
        }

        #endregion
    }

}
